﻿package {
	import flash.display.*;
	import flash.filters.*;
	import flash.utils.*;
	import flash.geom.*;
	public class CenFunLogo extends Sprite {
		public function CenFunLogo():void {
			
			var logo:Shape = getCenFunLogo(stage.stageWidth - 20);
			logo.x = stage.stageWidth * 0.5;
			logo.y = stage.stageHeight * 0.5;
			addChild(logo);
			
		}
		public function getCenFunLogo(tw:Number):Shape {
			var logo:Shape = new Shape();
			logo.cacheAsBitmap = true;
			var th:Number = tw * 3 / 4;
			var tr:Number = tw / 4;
			var rd1:Number = Math.atan(3);
			var rd2:Number = Math.atan(3 / 8);
			var ed1:Number = Math.atan(1 / 4);
			var matr:Matrix = new Matrix();
			matr.createGradientBox(tw, th, Math.PI/2, -tw/2, -th/2);
			with (logo.graphics) {
				beginGradientFill(GradientType.LINEAR, [0x5fb45f, 0x008800], [1, 1], [0, 255], matr, SpreadMethod.PAD);
				lineStyle(1,0x008800,.5);
				moveTo(tr, 0);
				for (var i:Number = rd1; i <= (2*Math.PI-rd2); i = (i+.1)) {
					lineTo(tr+Math.cos(-i)*tr, Math.sin(-i)*tr);
				}
				for (var j:Number = (2*Math.PI-ed1); j >= (ed1-.1); j = (j-.1)) {
					lineTo(Math.cos(-j)*tw/2, Math.sin(-j)*th/2);
				}
				lineTo(tr, 0);
				endFill();
			}
			return logo;
		}
	}
}